package com.nbsaas.boot.job.rest.resource;

import com.nbsaas.boot.job.api.apis.JobApi;
import com.nbsaas.boot.job.data.entity.Job;
import com.nbsaas.boot.job.api.domain.request.JobRequest;
import com.nbsaas.boot.job.api.domain.response.JobResponse;
import com.nbsaas.boot.job.api.domain.simple.JobSimple;
import com.nbsaas.boot.job.rest.convert.JobSimpleConvert;
import com.nbsaas.boot.job.rest.convert.JobEntityConvert;
import com.nbsaas.boot.job.rest.convert.JobResponseConvert;
import com.nbsaas.boot.job.data.repository.JobRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   职位-业务接口实现
*/
@Transactional
@Service
public class JobResource extends BaseResource<Job,JobResponse, JobSimple, JobRequest>  implements JobApi {

    @Resource
    private JobRepository jobRepository;

    @Override
    public JpaRepositoryImplementation<Job, Serializable> getJpaRepository() {
        return jobRepository;
    }

    @Override
    public Function<Job, JobSimple> getConvertSimple() {
        return new JobSimpleConvert();
    }

    @Override
    public Function<JobRequest, Job> getConvertForm() {
        return new JobEntityConvert();
    }

    @Override
    public Function<Job, JobResponse> getConvertResponse() {
        return new JobResponseConvert();
    }




}


